﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/SiteMaster.master"
    CodeBehind="EditReward.aspx.cs" Inherits="CivilleWebRole.EditReward" %>

<%@ Register Assembly="CivilleWebRole" Namespace="CivilleWebRole" TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyContent" runat="server">
    <table style="width: 100%;">
        <tr>
            <td>
                &nbsp;
                <asp:Label ID="TitleLbl" runat="server" Text="Title"></asp:Label>
            </td>
            <td>
                &nbsp;
                <asp:TextBox ID="TitleTxt" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="TitleRequired" runat="server" ControlToValidate="TitleTxt"
                    CssClass="failureNotification" ErrorMessage="Title is required." ToolTip="Title is required."
                    ValidationGroup="EditRewardValidationGroup"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
                <asp:Label ID="DescriptionLbl" runat="server" Text="Description"></asp:Label>
            </td>
            <td>
                &nbsp;
                <asp:TextBox ID="DescriptionTxt" runat="server" TextMode="MultiLine" Height="97px"
                    Width="331px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="DescriptionRequired" runat="server" ControlToValidate="DescriptionTxt"
                    CssClass="failureNotification" ErrorMessage="Description is required." ToolTip="Description is required."
                    ValidationGroup="EditRewardValidationGroup"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
                <asp:Label ID="TasksLbl" runat="server" Text="Tasks"></asp:Label>
            </td>
            <td>
                <asp:GridView ID="TasksGridView" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                    AllowSorting="True" DataSourceID="TasksDataSource" DataKeyNames="ID">
                    <Columns>
                        <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                        <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                        <asp:BoundField DataField="Latitude" HeaderText="Latitude" SortExpression="Latitude" />
                        <asp:BoundField DataField="Longitude" HeaderText="Longitude" SortExpression="Longitude" />
                        <asp:BoundField DataField="Points" HeaderText="Points" SortExpression="Points" />
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:Label ID="ColumnHeader" runat="server"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox runat="server" ID="TaskSelector" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:Label ID="ColumnHeader" runat="server" Text="Count"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:TextBox ID="CountTxt" runat="server" Text="1" Width="30"></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <asp:SqlDataSource ID="TasksDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CivilleConnectionString %>"
                    SelectCommand="SELECT [Task].[ID], [Task].[Title], [Task].[Description], [Task].[Latitude], [Task].[Longitude], [Task].[Points] FROM [Task], [Stakeholder] WHERE [Stakeholder].[Name] = @Name AND [Task].[StakeholderID] = [Stakeholder].[ID]">
                    <SelectParameters>
                        <cc1:UserParameter Name="Name" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
                <asp:Label ID="ExpiringDate" runat="server" Text="Expiring Date"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="SelectedExpiringDate" runat="server" Visible="false"></asp:TextBox>
                <asp:Calendar ID="ExpiringDateCalendar" runat="server" OnSelectionChanged="Calendar_SelectionChanged">
                </asp:Calendar>
                <asp:RequiredFieldValidator ID="ExpiringDateRequiredFieldValidator" runat="server" ControlToValidate="SelectedExpiringDate" 
                CssClass="failureNotification" ErrorMessage="Expiring Date is required." ToolTip="Expiring Date is required." 
                ValidationGroup="EditRewardValidationGroup"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
                <asp:Label ID="LogoLbl" runat="server" Text="Logo"></asp:Label>
            </td>
            <td>
                &nbsp;
                <asp:FileUpload ID="FileUpload" runat="server" />
                <asp:Label ID="StatusLabel" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                &nbsp;
                <asp:Button ID="SaveRewardBtn" runat="server" Text="Save" OnClick="SaveRewardButtonClick"
                    ValidationGroup="EditRewardValidationGroup" />
            </td>
        </tr>
    </table>
</asp:Content>
